public class PrintLetterThread extends Thread {
    @Override
    public void run() {
        synchronized (Main.class) {
            for (int i = 0; i < 26; i++) {
                try {
                    Main.class.wait();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                System.out.print((char) ('A' + i) + " ");
                Main.class.notify();
            }
        }
    }
}
